home *** CD-ROM | disk | FTP | other *** search
- { transfer.pas -- Demonstrate OWL's transfer mechanism }
-
- program Transfer;
-
- {$R transfer.res}
-
- uses WinTypes, WinProcs, WObjects;
-
- const
-
- id_Menu = 100; { Menu resource ID }
- id_Dialog = 200; { Dialog resource ID }
- cm_Dialog = 101; { Dialog command value }
- cm_Quit = 102; { Exit command value }
- id_CBGroup = 101; { Check box group ID }
- id_RBGroup = 102; { Radio button group ID }
- id_CB1 = 103; { Check box IDs }
- id_CB2 = 104;
- id_CB3 = 105;
- id_RB1 = 106; { Radio button IDs }
- id_RB2 = 107;
- id_Edit = 108; { Edit control ID }
- editLen = 128; { Maximum length of edit control }
-
- type
-
- TransferRec = record
- CB1, CB2, CB3: Word;
- RB1, RB2: Word;
- Edit: array[0 .. editLen] of Char
- end;
-
- TransferApplication = object(TApplication)
- procedure InitMainWindow; virtual;
- end;
-
- PTransferWindow = ^TransferWindow;
- TransferWindow = object(TWindow)
- DiagData: TransferRec;
- constructor Init(AParent: PWindowsObject; ATitle: PChar);
- procedure CMDialog(var Msg: TMessage);
- virtual cm_First + cm_Dialog;
- procedure CMQuit(var Msg: TMessage);
- virtual cm_First + cm_Quit;
- end;
-
- PTransferDlg = ^TransferDlg;
- TransferDlg = object(TDialog)
- constructor Init(AParent: PWindowsObject; AName: PChar);
- end;
-
-
- { TransferApplication }
-
- {- Initialize TransferApplication object's window }
- procedure TransferApplication.InitMainWindow;
- begin
- MainWindow := New(PTransferWindow, Init(nil, 'Transfer Demo'))
- end;
-
-
- { TransferWindow }
-
- {- Construct TransferWindow object }
- constructor TransferWindow.Init(AParent: PWindowsObject; ATitle: PChar);
- begin
- TWindow.Init(AParent, ATitle);
- Attr.Menu := LoadMenu(HInstance, PChar(id_Menu));
- FillChar(DiagData, Sizeof(DiagData), 0);
- DiagData.RB1 := 1
- end;
-
- {- Execute Dialog command }
- procedure TransferWindow.CMDialog(var Msg: TMessage);
- var
- PD: PDialog;
- begin
- PD := New(PTransferDlg, Init(@Self, PChar(id_Dialog)));
- PD^.TransferBuffer := @DiagData;
- Application^.ExecDialog(PD)
- end;
-
- {- Execute Exit command }
- procedure TransferWindow.CMQuit(var Msg: TMessage);
- begin
- CloseWindow
- end;
-
-
- { TransferDlg }
-
- {- Construct TransferDlg instance }
- constructor TransferDlg.Init(AParent: PWindowsObject; AName: PChar);
- var
- AControl: PControl;
- begin
- TDialog.Init(AParent, AName);
- AControl := New(PCheckBox, InitResource(@Self, id_CB1));
- AControl := New(PCheckBox, InitResource(@Self, id_CB2));
- AControl := New(PCheckBox, InitResource(@Self, id_CB2));
- AControl := New(PRadioButton, InitResource(@Self, id_RB1));
- AControl := New(PRadioButton, InitResource(@Self, id_RB2));
- AControl := New(PEdit, InitResource(@Self, id_Edit, editlen + 1));
- end;
-
- var
-
- TransferApp: TransferApplication;
-
- begin
- TransferApp.Init('TransferApp');
- TransferApp.Run;
- TransferApp.Done
- end.
-
-
- {--------------------------------------------------------------
- Copyright (c) 1991 by Tom Swan. All rights reserved.
- Revision 1.00 Date: 5/11/1991
- ---------------------------------------------------------------}
-